<?php
dump($_SESSION);
phpinfo();
	print_r($myArray);
	echo "foreach循环数组<br>";
	
	//循环遍历数组，$myValue是数组的值，这种方式无法遍历出key
	foreach($myArray as $key=>$myValue){
		echo "$key----$myValue<br>";
	}

	echo "<br>";
	echo "list each while 循环数组<br>";
	//将数组内部指针指向第一个元素
	reset($myArray);
	//使用list和each两个函数来遍历数组
	// each返回数组中当前的key/value，并将数组指针向前移动一步，当碰到数组结尾时停留在最后一个元素，如果要再使用each则必须使用reset函数
	// 把数组中的值赋给一些变量
	while(list($key,$value) = each($myArray)){
		echo "$key----$value<br>";
	}

	echo "<br>";
	echo "<br>";
	
	$info = array("coffee","brown","caffeine");
	//列出所有的变量
	list($drink,$color,$power) = $info;
	echo "$drink----$color----$power<br>";

	echo "<br>";
	echo "字符串转为数字 explode<br>";
	//字符串转为数字
	$str1 = "时装#休闲#职业装";
	$str1_array = explode("#",$str1);
	foreach($str1_array as $key=>$value){
		echo "$key=>$value<br>";
	}
	echo "<br>";
	echo "将数组转为字符串<br>";
	echo implode("*****",$str1_array);	

	echo "<br>";
	echo "<br>";
	echo "count计算数组的长度<br>";
	echo "数组长度 : ".count($str1_array);

	echo "<br>";
	echo "<br>";
	echo "array_search()在数组中搜索给定的值，如果成功则返回相应的键名 <br>";
	reset($myArray);
	print_r($myArray);
	echo "<br>";
	echo array_search("huangbiao",$myArray)."<br>";
	//echo array_search("name",$myArray)."<br>";
	if(array_search("name",$myArray)){
		echo "OK.<br>";
	}else{
		echo "no found<br>";
	}

	
	echo "<br>";
	echo "<br>";
	echo "strlen()计算字符串长度<br>";
	$str2 = "黄彪";
	echo "strlen($str2) : " . strlen($str2);
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
	echo "<br>";
?>